package server;

import java.io.*;
import java.net.*;

import common.ServerInterface;




public class RMIServer implements ServerInterface{
		
		public void start(int port) {
			try{
				Gioco.getInstance().getMappa().inizializzaMappa();
				ServerSocket serverSocket= new ServerSocket(port);
				
				while(true){
					System.out.println("in attesa su " + port);
					Socket socket= serverSocket.accept();
					System.out.println("ricevuta connessione: " + socket.getInetAddress() + ":" + socket.getPort());
					(new SocketClientHandler(socket)).start();
				}
			}
			catch(IOException e) {
				e.printStackTrace();
			}
			
			}
		
		public static void main(String[] args) throws IOException{
			SocketServer serv = new SocketServer();
			serv.start(8888);
		}	
	}

